package com.example.usharingtest.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.usharingtest.R;
import com.example.usharingtest.model.Article;
import com.squareup.picasso.Picasso;

/**
 * Created by X on 2017/9/4.
 */
public class ArticleFragment extends Fragment {
    @Override
    public boolean getAllowEnterTransitionOverlap() {
        return super.getAllowEnterTransitionOverlap();
    }

    @Override
    public void onPause() {
        super.onPause();
    }

    @Override
    public void onResume() {
        super.onResume();
    }

    @Override
    public void onStop() {
        super.onStop();
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Article article = (Article)getArguments().getSerializable("art");
        ImageView Puphoto = (ImageView)getView().findViewById(R.id.pu_photo);
        TextView puname = (TextView)getView().findViewById(R.id.pu_name);
        TextView putime = (TextView)getView().findViewById(R.id.pu_time);
        TextView pucontent = (TextView)getView().findViewById(R.id.pu_content);
        ImageView puimage = (ImageView)getView().findViewById(R.id.pu_image);

        Picasso.with(getContext()).load(R.string.URL_SERVER+article.getUser().getUserphotopath()).into(Puphoto);
        puname.setText(article.getUser().getUsername());
        putime.setText(article.getPublishtime().toString());
        pucontent.setText(article.getContent());
        Picasso.with(getContext()).load(R.string.URL_SERVER+article.getPhotopath()).into(puimage);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.userpostdetail,container,false);
    }
}
